package tc.de.krawallmann.gravoblocks.game.model;

/**
 * The Class TetrisBlock defines a Block that has a color, blocked and ghost
 * attribute.
 * 
 * @author KrawallMann
 * @version 1.0
 */
public class TetrisBlock extends Block {

	public static final String BLOCKED = "blocked";

	public static final String COLOR = "color";

	public static final String GHOST = "ghost";

	public static final String MARKED_TO_REMOVE = "markedToRemove";

	public static final String TRANSPARENT = "transparent";

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 2126265485636153312L;

	private static final String METALLIC = "metallic";

	/** The blocked state. */
	private boolean blocked;

	/** The color. */
	private BlockColor color;

	/** The ghost state. */
	private boolean ghost;

	/** The marked to remove. */
	private boolean markedToRemove;

	private boolean metallic;

	/** The transparent state. */
	private boolean transparent;

	/**
	 * Instantiates a new TetrisBlock.
	 */
	public TetrisBlock() {
		super();
	}

	/**
	 * Instantiates a new tetris block.
	 * 
	 * @param xPosition
	 *            the x position
	 * @param yPosition
	 *            the y position
	 */
	public TetrisBlock(final int xPosition, final int yPosition) {
		super(xPosition, yPosition);
		color = BlockColor.WHITE;
	}

	/**
	 * Instantiates a new TetrisBlock.
	 * 
	 * @param xPosition
	 *            the x position
	 * @param yPosition
	 *            the y position
	 * @param color
	 *            the color
	 */
	public TetrisBlock(final int xPosition, final int yPosition, final BlockColor color) {
		super(xPosition, yPosition);
		this.color = color;
	}

	/**
	 * Gets the color.
	 * 
	 * @return the color
	 */
	public BlockColor getColor() {
		return color;
	}

	/**
	 * Checks if this TetrisBlock is blocked.
	 * 
	 * @return true, if it is blocked
	 */
	public boolean isBlocked() {
		return blocked;
	}

	/**
	 * Checks if this TetrisBlock is a ghost.
	 * 
	 * @return true, if it is ghost
	 */
	public boolean isGhost() {
		return ghost;
	}

	/**
	 * Checks if is marked to remove.
	 * 
	 * @return true, if is marked to remove
	 */
	public boolean isMarkedToRemove() {
		return markedToRemove;
	}

	public boolean isMetallic() {
		return metallic;
	}

	/**
	 * Checks if this TetrisBlick is transparent.
	 * 
	 * @return true, if it is transparent
	 */
	public boolean isTransparent() {
		return transparent;
	}

	/**
	 * Sets the blocked state.
	 * 
	 * @param blocked
	 *            the new blocked state
	 */
	public void setBlocked(final boolean blocked) {
		firePropertyChange(TetrisBlock.BLOCKED, this.blocked, blocked);
		this.blocked = blocked;
	}

	/**
	 * Sets the color.
	 * 
	 * @param color
	 *            the new color
	 */
	public void setColor(final BlockColor color) {
		firePropertyChange(TetrisBlock.COLOR, this.color, color);
		this.color = color;
	}

	/**
	 * Sets the ghost state.
	 * 
	 * @param ghost
	 *            the new ghost state
	 */
	public void setGhost(final boolean ghost) {
		firePropertyChange(TetrisBlock.GHOST, this.ghost, ghost);
		this.ghost = ghost;
	}

	/**
	 * Sets the marked to remove.
	 * 
	 * @param markedToRemove
	 *            the new marked to remove
	 */
	public void setMarkedToRemove(final boolean markedToRemove) {
		firePropertyChange(TetrisBlock.MARKED_TO_REMOVE, this.markedToRemove, markedToRemove);
		this.markedToRemove = markedToRemove;
	}

	public void setMetallic(final boolean metallic) {
		firePropertyChange(TetrisBlock.METALLIC, this.metallic, metallic);
		this.metallic = metallic;
	}

	/**
	 * Sets the transparent state.
	 * 
	 * @param transparent
	 *            the new transparent state
	 */
	public void setTransparent(final boolean transparent) {
		firePropertyChange(TetrisBlock.TRANSPARENT, this.transparent, transparent);
		this.transparent = transparent;
	}
}
